<?php
include('connection/connection.php');
$form_id=trim($_REQUEST['frmId']);
$sqlGetFormDetails="select * from tbl_dtls_q2_main where id=$form_id";
$queryFormDetails=mysql_query($sqlGetFormDetails);
$rowFormDetails=mysql_fetch_array($queryFormDetails);
if(isset($_POST['submit']))
{
	$q2_id=$form_id;
	$OA_current_status=$_POST['OA_current_status'];
	if($_POST['OA_operational_status']!='Other')
	{
		$OA_operational_status=$_POST['OA_operational_status'];
	}
	else
	{	
		$OA_operational_status=$_POST['OA_operational_other'];
	}
	$manpower_cost_09_10=$_POST['manpower_cost_09_10'];
	$manpower_cost_08_09=$_POST['manpower_cost_08_09'];
	$manpower_cost_07_08=$_POST['manpower_cost_07_08'];
	$material_cost_09_10=$_POST['material_cost_09_10'];
	$material_cost_08_09=$_POST['material_cost_08_09'];
	$material_cost_07_08=$_POST['material_cost_07_08'];
	$maintenence_machanism=$_POST['maintenence_machanism'];
	$exist_report_sys=$_POST['exist_report_sys'];
	$report_other=$_POST['report_other'];
	$exist_report_sys=implode(',',$exist_report_sys); 
	$exist_report_sys=$exist_report_sys . $report_other;
	$time_taken=$_POST['time_taken'];
	$institutional=$_POST['institutional'];
	$institutional_other=$_POST['institutional_other'];
	$institutional=implode(',',$institutional); 
	$institutional=$institutional . $institutional_other;
	$financial=$_POST['financial'];
	$financial_other=$_POST['financial_other'];
	$financial=implode(',',$financial); 
	$financial=$financial . $financial_other;
	$operational=$_POST['operational'];
	$operational_other=$_POST['operational_other'];
	$operational=implode(',',$operational); 
	$operational=$operational . $operational_other;
	
	$qry="UPDATE tbl_dtls_q2_main SET OA_current_status = '$OA_current_status', OA_operational_status = '$OA_operational_status', manpower_cost_09_10 = '$manpower_cost_09_10', manpower_cost_08_09 = '$manpower_cost_08_09', manpower_cost_07_08 = '$manpower_cost_07_08', material_cost_09_10 = '$material_cost_09_10', material_cost_08_09 = '$material_cost_08_09', material_cost_07_08 = '$material_cost_07_08', maintenence_machanism = '$maintenence_machanism', existing_reporting_system  = '$exist_report_sys', time_taken = '$time_taken', constraint_institutional = '$institutional', constraint_financial = '$financial', constraint_operational = '$operational' where id='$q2_id'";
	//echo $qry;exit;
	$rec=mysql_query($qry);
	
	$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$form_id','111','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
mysql_query($qryHistory);
	if($rec)
	{
		header("location:q2.php");
	}
}

?>
